const Service = require('egg').Service

class UserService extends Service{
     //查询用户
     async index(username){
         const {app}=this
         return app.mysql.query('select * from users where username=?',[username])
     }
     //注册接口
     async reg(username,password){
         const {app}=this;
         return app.mysql.query('insert into users (username,password) values (?,?)',[username,password])
     }
     //登录接口
     async login(username,password){
         const {app}=this;
         return app.mysql.query('select * from users where username=? and password=?',[username,password])
     }
     //获取列表接口
     async getlist(){
         const {app}=this;
         return app.mysql.query('select * from list')
     }
}

module.exports=UserService